package cn.leaf.calculator.bean;


import cn.leaf.calculator.Stateful;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 参数
 *
 * @author 李克国
 * @version 1.0.0
 */
@EqualsAndHashCode
public class ParamEntity<T> implements Stateful {

    /**
     * 参数
     */
    public static final int PARAM_INIT = 1;
    /**
     * 参数：丢弃
     */
    public static final int PARAM_DISCARD = 2;

    @Builder.Default
    private int state = PARAM_INIT;
    @Setter
    @Getter
    private Serializable id;
    @Setter
    @Getter
    private String name;
    @Setter
    @Getter
    private BigDecimal value;

    @Setter
    @Getter
    private T bodyEntity;

    @Override
    public void updateState(int state) {
        this.state = state;
    }

    @Override
    public int getState() {
        return state;
    }

    public ParamEntity() {
    }

    public ParamEntity(Serializable id) {
        this.id = id;
    }
}
